<template>
	<view class="page_scroll_view">
		<tn-navbar fixed :bottom-shadow="false">商品详情</tn-navbar>
		<tn-sticky class="tn-white_bg">
			<view class="tn-flex items-center tn-p-sm">
				<tn-avatar
					:url="goodInfo.goods_thumb?goodInfo.goods_thumb:'https://sgymv1.oss-cn-beijing.aliyuncs.com/sgym/avatar/admin/2024/11/9ccf98d5-b98d-4371-aeda-4cc50314d4e7453ab7651200438c6997a0665aec4063.png'"
					size="xl" />
				<view class="tn-ml-sm tn-flex tn-flex-column tn-text-xs" style="line-height: 1.7;">
					<text class="tn-mr-xs tn-text-ellipsis-1">商品名称：{{goodInfo.goods_title}}</text>
					<text class="tn-text-ellipsis-1">商品单价：￥{{goodInfo.goods_price}}</text>
					<text class="tn-text-ellipsis-1">配送商：{{goodInfo.deliveryName}}</text>
				</view>
			</view>
			<view class="gap" style="margin: 15rpx 0 10rpx;"></view>
			<tn-tabs v-model="currentTabIndex">
				<tn-tabs-item v-for="(item, index) in tabsData" :key="index" :title="item.text" />
				<template #bar>
					<tn-icon name="tabs-smile" type="primary" />
				</template>
			</tn-tabs>
		</tn-sticky>
		<scroll-view scroll-y="true">
			<view class="tn-p tn-pb-sm">
				<GoodBaseInfoVue :userId="goodInfo.id" v-if="currentTabIndex==0"></GoodBaseInfoVue>
				<GoodInfoVue :userId="goodInfo.id" v-if="currentTabIndex==1"></GoodInfoVue>
			</view>
			<view style="height: 50rpx;"></view>
		</scroll-view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue"
	import GoodBaseInfoVue from "./components/GoodBaseInfo.vue"
	import GoodInfoVue from "./components/GoodInfo.vue"
	import {
		onLoad
	} from "@dcloudio/uni-app"

	onLoad((e) => {
		goodInfo.value = JSON.parse(decodeURIComponent(e.item))
	})

	const tabsData = [{
			text: '基础信息',
		},
		{
			text: '商品信息',
		}
	]
	const currentTabIndex = ref(0)
	const goodInfo = ref({})

	// 
</script>

<style scoped lang="scss">

</style>